/*! \file HXViseme.h
    \brief Viseme and blend shape parameters.
	Head X | Flinders University | Trent Lewis & Martin Luerssen | 2009+
*/

#pragma once

#include <string>
#include <vector>

using namespace std;

//-----------------------------------------------------------------------------

typedef unsigned __int32 HXBlendMode;
const HXBlendMode HXBM_LINEAR = 0x00000000;
const HXBlendMode HXBM_ROOT = 0x00000001;
const HXBlendMode HXBM_IROOT = 0x00000004;
const HXBlendMode HXBM_SQR = 0x00000002;
const HXBlendMode HXBM_ISQR = 0x00000005;
const HXBlendMode HXBM_HSIN = 0x00000003;
const HXBlendMode HXBM_IHSIN = 0x00000006;
const HXBlendMode HXBM_SIN = 0x00000007;
const HXBlendMode HXBM_SINC= 0x00000008;
const HXBlendMode HXBM_MAX= 0x00000010;
const HXBlendMode HXBM_DEFAULT = 0x00001000;
const HXBlendMode HXBM_ANYBLEND = 0x0000FFFF;

//-----------------------------------------------------------------------------

/*typedef unsigned __int32 HXMovementMode;
const HXMovementMode HXMOV_ROTATION = 0x00000001;
const HXMovementMode HXMOV_TRANSLATION = 0x00000002;
const HXMovementMode HXMOV_SCALE = 0x00000004;*/

enum HXMovementMode
{
	HXMOV_ROTATION,
	HXMOV_TRANSLATION,
	HXMOV_SCALE
};

//-----------------------------------------------------------------------------

struct HXViseme
{
	HXViseme();
	HXViseme(const wstring& _label, double _endpoint, double _duration, double _amplitude = 1.0, HXBlendMode _rampFunc = HXBM_DEFAULT);
	HXViseme(const wstring& _label, double _amplitude);

	wstring label;
	double duration;
	double endpoint;
	double amplitude;
	HXBlendMode rampFunc;
};

//-----------------------------------------------------------------------------

struct HXVisemeBlendShape
{
	HXVisemeBlendShape();

	wstring name;
	float amplitude;
	float offset;
	float duration;
	HXBlendMode rampFunc;
};

//-----------------------------------------------------------------------------

struct HXMovement
{
	HXMovement(HXMovementMode _mode);

	wstring group;
	float x, y, z;
	float offset;
	float duration;
	HXBlendMode rampFunc;
	HXMovementMode mode;
};

//-----------------------------------------------------------------------------

struct HXExpression
{
	HXExpression() : toggle(0.0f), bounce(true) {}

	wstring name;
	float toggle;
	bool bounce;
	vector<HXVisemeBlendShape> shapes;
	vector<HXMovement> movements;
};

//-----------------------------------------------------------------------------

struct HXIdleExpression
{
	HXIdleExpression();

	float minInterval;
	float maxInterval;
	float minDuration;
	float maxDuration;
	float minAmplitude;
	float maxAmplitude;
	float minHold;
	float maxHold;

	HXExpression expression;
};

//-----------------------------------------------------------------------------
